﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Mvc;

namespace CoolCode.Web.Mvc
{
    public  class MessageResult:JsonResult 
    {
        public bool Success { get; private  set; }
        public string Message{get; private  set; }

        public MessageResult(bool success):this(success,string.Empty )
        {
        }

        public MessageResult(bool success, string message)
        {
            this.Success = success;
            this.Message = message;
        }

        public override void ExecuteResult(ControllerContext context)
        {
            base.Data = new { success =this.Success , message=this.Message };
            base.JsonRequestBehavior = JsonRequestBehavior.AllowGet;
            base.ExecuteResult(context);
        }
    }
}
